//
//  tel-phoneViewController.m
//  tongxunlu
//
//  Created by mac on 15-11-16.
//  Copyright (c) 2015年 yb. All rights reserved.
//

#import "tel-phoneViewController.h"
#import "ViewController.h"

@interface tel_phoneViewController ()
{
    NSArray *name;
    NSArray *no;
    NSArray *tel;
    
}
@end

@implementation tel_phoneViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    name = @[
             @"安娜",
             ];
    
    no = @[
           @"1",
           ];
    
    tel = @[
            @"15112345678",
            ];
    
    self.title = @"第三界面";
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
//{
//    return name.count;
//}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [name[section]count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *ce = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil];
    ce.textLabel.text = name[indexPath.row ];
    
    return ce;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        NSMutableArray * a = name.mutableCopy;
        [a removeObjectAtIndex:indexPath.row];
        name = a;
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
    }
}



- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
